#ifndef BLOCK_H
#define BLOCK_H

#include <QLinkedList>
#include <QSize>
#include "segment.h"

template <typename T>
class Block : public Segment
{
private:
    QLinkedList<T> items;
public:
    Block(const Point2d & bottomLeft = Point2d(0, 0), double vsize = 0, double hsize = 0):
    Segment(bottomLeft, vsize, hsize)
    {}

    const T & front() const
    {
        return items.front();
    }

    const T & back() const
    {
        return items.back();
    }

    void pushFront(const T & item)
    {
        items.push_front(item);
    }

    void pushBack(const T & item)
    {
        items.push_back(item);
    }

    QLinkedList<T> & getItems()
    {
        return items;
    }

    inline bool empty() const
    {
        return items.empty();
    }
};

#endif // BLOCK_H
